package com.itfreer.cms.dao.module;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;

import org.springframework.beans.BeanUtils;

import com.itfreer.cms.entity.module.SensitiveEntity;
import com.itfreer.form.api.JdbcBaseEntity;

/**
 * 定义敏感词实体类
 */
@Entity(name = "cms_sensitive")
public class JdbcSensitiveEntity implements JdbcBaseEntity<SensitiveEntity>, Serializable {

	private static final long serialVersionUID = -5035223785977167462L;

	/**
	 * id值，主键，唯一值
	 * 系统应用中必需关联此值
	 */
	@Id
	@Column(name = "id", length = 50, nullable = false)
	private String id;
	
	/**
	 * 敏感词
	 */
	@Column(name = "s_sensitive", length = 20, nullable = false)
	private String sensitive;

	/**
	 * 替代词
	 */
	@Column(name = "s_replace", length = 20, nullable = true)
	private String replace;

	/**
	 * 状态
	 */
	@Column(name = "s_state", length = 20, nullable = false)
	private String state;
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getSensitive() {
		return sensitive;
	}

	public void setSensitive(String sensitive) {
		this.sensitive = sensitive;
	}

	public String getReplace() {
		return replace;
	}

	public void setReplace(String replace) {
		this.replace = replace;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	@Override
	public void from(SensitiveEntity t) {
		BeanUtils.copyProperties(t, this);
	}

	@Override
	public SensitiveEntity toEntity() {
		SensitiveEntity toEntity = new SensitiveEntity();
		BeanUtils.copyProperties(this, toEntity);
		return toEntity;
	}
}
